package com.whitedust.top60;

import com.whitedust.structure.ListNode;

/**
 *
 * @author A
 * @since 2025/11/11 12:54
 */

public class Top58 {
    public ListNode trainingPlan(ListNode head, int cnt) {
        ListNode slow = head;
        ListNode fast = head;
        for (int i = 0; i < cnt && fast != null; i++) {
            fast = fast.next;
        }
        while (fast != null) {
            slow = slow.next;
            fast = fast.next;
        }
        return slow;
    }
}
